package com.ruoyi.labdata.service.impl;

import com.ruoyi.labdata.domain.LabReservation;
import com.ruoyi.labdata.service.EndTaskListener;
import com.ruoyi.labdata.service.ILabReservationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 实验室预约流程监听器
 *
 * @author ruoyi
 * @date 2022-03-27
 */
@Service
public class LabReservationEndTaskListener extends EndTaskListener<LabReservation> {

    @Autowired
    private ILabReservationService labReservationService;

    @Override
    public int doTask(Long instanceId) {
        LabReservation labReservation = labReservationService.selectLabReservationById(instanceId);
        labReservation.setStatus("1");
        return labReservationService.updateLabReservationStatus(labReservation);
    }
}